import request from "@/router/axios";

export const getList = (current, size, params) => {
  let userinfo = localStorage.getItem("sryx-userInfo");
  let companyid = JSON.parse(userinfo).content.depart_id;
  let isadmin = JSON.parse(userinfo).content.is_admin;
  return request({
    url: "/api/oms-system/base/advertiserlist",
    method: "get",
    params: {
      ...params,
      companyid,
      isadmin,
      current,
      size,
    },
  });
};
export const add = (row) => {
  let userinfo = localStorage.getItem("sryx-userInfo");
  let departid = JSON.parse(userinfo).content.depart_id;
  debugger;
  return request({
    url: "/api/oms-system/base/addadvertiser",
    method: "post",
    data: Object.assign(row, { departid: departid }, { companyid: departid }),
  });
};
export const update = (row) => {
  delete row["created_at"];
  delete row["updated_at"];
  delete row["code"];
  let userinfo = localStorage.getItem("sryx-userInfo");
  let departid = JSON.parse(userinfo).content.depart_id;
  return request({
    url: "/api/oms-system/base/addadvertiser",
    method: "post",
    data: Object.assign(row, { companyid: departid }),
  });
};
